<html>
<head><meta charset="utf-8"><title>lifetimes, self, projections #61949 · wg-async-foundations · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/index.html">wg-async-foundations</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/lifetimes.2C.20self.2C.20projections.20.2361949.html">lifetimes, self, projections #61949</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="169898088"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/lifetimes%2C%20self%2C%20projections%20%2361949/near/169898088" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/lifetimes.2C.20self.2C.20projections.20.2361949.html#169898088">(Jul 08 2019 at 19:36)</a>:</h4>
<p>So on the topic of "Inherent async fn returning <code>Self</code> treats type's lifetime parameters as <code>'static</code>" (<a href="https://github.com/rust-lang/rust/issues/61949" target="_blank" title="https://github.com/rust-lang/rust/issues/61949">#61949</a>) -- we had discussed trying to hack together a feature-gate for <code>async fn</code>. I found that there are other, similar problems around projections. (In particular, <code>T::Item</code> can expand to <code>&lt;T as Foo&lt;'a&gt;&gt;::Item</code>...). </p>
<p>I think we should separate these two issues, though:</p>
<ul>
<li>we can fix the <code>Self</code> issue properly, or at least feature-gate it, readily enough</li>
<li>the <code>T::Item</code> issue is harder and more subtle, but also less common for people to stumble on</li>
</ul>



<a name="169903013"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/lifetimes%2C%20self%2C%20projections%20%2361949/near/169903013" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/lifetimes.2C.20self.2C.20projections.20.2361949.html#169903013">(Jul 08 2019 at 20:41)</a>:</h4>
<p>lol apparently I filed <a href="https://github.com/rust-lang/rust/issues/51525" target="_blank" title="https://github.com/rust-lang/rust/issues/51525">https://github.com/rust-lang/rust/issues/51525</a> in 2018 and promptly forgot about it</p>



<a name="170442956"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/lifetimes%2C%20self%2C%20projections%20%2361949/near/170442956" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/lifetimes.2C.20self.2C.20projections.20.2361949.html#170442956">(Jul 09 2019 at 10:59)</a>:</h4>
<p>I'm going to try and write-up some mentoring instructions to resolve <a href="https://github.com/rust-lang/rust/issues/61949" target="_blank" title="https://github.com/rust-lang/rust/issues/61949">#61949</a>, but ignoring the issue described in <a href="https://github.com/rust-lang/rust/issues/51525" target="_blank" title="https://github.com/rust-lang/rust/issues/51525">#51525</a>, which I think we should try to solve separately -- perhaps by just reporting an error if we expand to <code>&lt;T as Foo&lt;'a&gt;&gt;::Bar</code> in an impl trait for now.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>